package com.hiultra.archive.controller;

import java.net.URISyntaxException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.hiultra.archive.domain.ArchiveBoxinnerMoveTask;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hiultra.common.annotation.Log;
import com.hiultra.common.core.controller.BaseController;
import com.hiultra.common.core.domain.AjaxResult;
import com.hiultra.common.enums.BusinessType;
import com.hiultra.archive.domain.ArchiveBoxMoveTask;
import com.hiultra.archive.service.IArchiveBoxMoveTaskService;
import com.hiultra.common.utils.poi.ExcelUtil;
import com.hiultra.common.core.page.TableDataInfo;

/**
 * 盒移位任务Controller
 *
 * @author 派大星
 * @date 2024-07-23
 */
@RestController
@RequestMapping("/archive/ArchiveBoxMoveTask")
public class ArchiveBoxMoveTaskController extends BaseController
{
    @Autowired
    private IArchiveBoxMoveTaskService archiveBoxMoveTaskService;

    /**
     * 查询盒移位任务列表
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxMoveTask:list')")
    @GetMapping("/list")
    public TableDataInfo list(ArchiveBoxMoveTask archiveBoxMoveTask)
    {
        startPage();
        List<ArchiveBoxMoveTask> list = archiveBoxMoveTaskService.selectArchiveBoxMoveTaskList(archiveBoxMoveTask);
        return getDataTable(list);
    }

    /**
     * 导出盒移位任务列表
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxMoveTask:export')")
    @Log(title = "盒移位任务", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ArchiveBoxMoveTask archiveBoxMoveTask)
    {
        List<ArchiveBoxMoveTask> list = archiveBoxMoveTaskService.selectArchiveBoxMoveTaskList(archiveBoxMoveTask);
        ExcelUtil<ArchiveBoxMoveTask> util = new ExcelUtil<ArchiveBoxMoveTask>(ArchiveBoxMoveTask.class);
        util.exportExcel(response, list, "盒移位任务数据");
    }

    /**
     * 获取盒移位任务详细信息
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxMoveTask:query')")
    @GetMapping(value = "/{taskId}")
    public AjaxResult getInfo(@PathVariable("taskId") String taskId)
    {
        return AjaxResult.success(archiveBoxMoveTaskService.selectArchiveBoxMoveTaskByTaskId(taskId));
    }

    /**
     * 新增盒移位任务
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxMoveTask:add')")
    @Log(title = "盒移位任务", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ArchiveBoxMoveTask archiveBoxMoveTask)
    {
        return toAjax(archiveBoxMoveTaskService.insertArchiveBoxMoveTask(archiveBoxMoveTask));
    }

    /**
     * 修改盒移位任务
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxMoveTask:edit')")
    @Log(title = "盒移位任务", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ArchiveBoxMoveTask archiveBoxMoveTask)
    {
        return toAjax(archiveBoxMoveTaskService.updateArchiveBoxMoveTask(archiveBoxMoveTask));
    }

    /**
     * 删除盒移位任务
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxMoveTask:remove')")
    @Log(title = "盒移位任务", businessType = BusinessType.DELETE)
	@DeleteMapping("/{taskIds}")
    public AjaxResult remove(@PathVariable String[] taskIds)
    {
        return toAjax(archiveBoxMoveTaskService.deleteArchiveBoxMoveTaskByTaskIds(taskIds));
    }
}
